local joyex__duanliang = fk.CreateSkill {

  name = "joyex__duanliang",

  tags = {  },

}



joyex__duanliang:addEffect("viewas", {
  name = "joyex__duanliang",
  anim_type = "control",
  pattern = "supply_shortage",
  prompt = "#joyex__duanliang",
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).color == Card.Black and Fk:getCardById(to_select).type ~= Card.TypeTrick
  end,
  view_as = function(self, player,cards)
    if #cards ~= 1 then return end
    local card = Fk:cloneCard("supply_shortage")
    card.skillName = joyex__duanliang.name
    card:addSubcard(cards[1])
    return card
  end,
})

joyex__duanliang:addEffect("targetmod", {
  name = "#joyex__duanliang_targetmod",
  --joyex__duanliang,
  bypass_distances =  function(self, player, skill, card, to)
    return player:hasSkill(joyex__duanliang.name) and skill.name == "supply_shortage_skill" and to:getHandcardNum() >= player:getHandcardNum()
  end,
})

return joyex__duanliang